package com.example.fanplant.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.fanplant.model.JSONResult;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/fans")
public class FansController {
    /*
     *
     * 2、通过HttpServletRequest接收   http://localhost:8080/fans/get_fan?fan=fan1
     *
     */

    @RequestMapping("/get_fan")
    public ModelAndView test_FanResult(HttpServletRequest request, Model model) {
        String fan = request.getParameter("fan");

        return new ModelAndView("bootstarp/fans-project/"+fan, "userModel", model);
    }

}


